package kmdigit.shop.dao.persistence.ibatis;

import kmdigit.shop.dao.domain.Category;
import kmdigit.shop.dao.persistence.CategoryDao;

import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.template.SqlMapDaoTemplate;


public class CategoryDaoImpl extends SqlMapDaoTemplate implements CategoryDao 
{

	public CategoryDaoImpl(DaoManager daoManager) {
		super(daoManager);
	}

	@Override
	public int delete(Category category) {
		return delete(category.getCategoryid());
	}
	
	@Override
	public int delete(String categoryId)
	{
		return delete("Category.delete", categoryId);
	}

	@Override
	public Category getById(String categoryId) {
		return (Category)queryForObject("Category.getById", categoryId);
	}

	@Override
	public Category getById(Category category) {
		return getById(category.getCategoryid());
	}

	@Override
	public Integer insert(Category category) {
		return (Integer) insert("Category.insert", category);
	}

	@Override
	public int update(Category category) {
		return update("Category.update", category);
	}

}
